package com.atguigu.testdemo.customer.service.impl;

import com.atguigu.testdemo.customer.bean.Customer;
import com.atguigu.testdemo.customer.mapper.CustomerMapper;
import com.atguigu.testdemo.customer.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("csi")
@DS("test")
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper , Customer> implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;


    @Override
    public void deleteCustomer(Long id) {
        customerMapper.deleteCustomer(id);
    }

    @Override
    public void updateCustomer(Customer customer) {
        customerMapper.updateCustomer(customer);
    }

    @Override
    public void saveCustomer(Customer customer) {
        customerMapper.InsertCustomer(customer);
    }

    @Override
    public Customer getCustomer(Long id) {
        //Customer customer = new Customer(id,"lixiaosi",10);

        Customer customer = customerMapper.selectCustomerById(id);
        return customer;
    }

    @Override
    public Customer getCustomer(String name, Integer age) {
        return customerMapper.selectCustomerByName(name,age);
    }

    @Override
    public void insertCustomerTest(String name, Integer age) {
        customerMapper.InsertCustomerTest(name,age);
    }


}
